<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Cookbook &raquo; Project Motivation | Taskflow QuickStart</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
  <link rel="icon" href="favicon.ico" type="image/x-icon" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta name="theme-color" content="#22272e" />
</head>
<body>
<header><nav id="navigation">
  <div class="m-container">
    <div class="m-row">
      <span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
        <a href="https://taskflow.github.io"><img src="taskflow_logo.png" alt="" />Taskflow</a> <span class="m-breadcrumb">|</span> <a href="index.html" class="m-thin">QuickStart</a>
      </span>
      <div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
        <a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
          <path id="m-doc-search-icon-path" d="m6 0c-3.31 0-6 2.69-6 6 0 3.31 2.69 6 6 6 1.49 0 2.85-0.541 3.89-1.44-0.0164 0.338 0.147 0.759 0.5 1.15l3.22 3.79c0.552 0.614 1.45 0.665 2 0.115 0.55-0.55 0.499-1.45-0.115-2l-3.79-3.22c-0.392-0.353-0.812-0.515-1.15-0.5 0.895-1.05 1.44-2.41 1.44-3.89 0-3.31-2.69-6-6-6zm0 1.56a4.44 4.44 0 0 1 4.44 4.44 4.44 4.44 0 0 1-4.44 4.44 4.44 4.44 0 0 1-4.44-4.44 4.44 4.44 0 0 1 4.44-4.44z"/>
        </svg></a>
        <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
        <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
      </div>
      <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
        <div class="m-row">
          <ol class="m-col-t-6 m-col-m-none">
            <li><a href="pages.html">Handbook</a></li>
            <li><a href="namespaces.html">Namespaces</a></li>
          </ol>
          <ol class="m-col-t-6 m-col-m-none" start="3">
            <li><a href="annotated.html">Classes</a></li>
            <li><a href="files.html">Files</a></li>
            <li class="m-show-m"><a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
              <use href="#m-doc-search-icon-path" />
            </svg></a></li>
          </ol>
        </div>
      </div>
    </div>
  </div>
</nav></header>
<main><article>
  <div class="m-container m-container-inflatable">
    <div class="m-row">
      <div class="m-col-l-10 m-push-l-1">
        <h1>
          <span class="m-breadcrumb"><a href="Cookbook.html">Cookbook</a> &raquo;</span>
          Project Motivation
        </h1>
        <nav class="m-block m-default">
          <h3>Contents</h3>
          <ul>
            <li><a href="#TheEraOfMulticore">The Era of Multicore</a></li>
            <li><a href="#C0HeterogeneousComputing">Heterogeneous Computing</a></li>
            <li><a href="#LoopLevelParallelism">Loop-level Parallelism</a></li>
            <li><a href="#TaskBasedParallelism">Task-based Parallelism</a></li>
            <li><a href="#TheProjectMantra">The Project Mantra</a></li>
          </ul>
        </nav>
<p>Taskflow addresses a long-standing problem, <em>how can we make it easier for C++ developers to quickly write parallel and heterogeneous programs with high performance scalability and simultaneous high productivity?</em></p><section id="TheEraOfMulticore"><h2><a href="#TheEraOfMulticore">The Era of Multicore</a></h2><p>In the past, we embrace <em>free</em> performance scaling on our software thanks to advances in manufacturing technologies and micro-architectural innovations. Approximately for every 1.5 year we can speed up our programs by simply switching to new hardware and compiler vendors that brings 2x more transistors, faster clock rates, and higher instruction-level parallelism. However, this paradigm was challenged by the power wall and increasing difficulties in exploiting instruction-level parallelism. The boost to computing performance has stemmed from changes to multicore chip designs.</p><img class="m-image" src="era_multicore.jpg" alt="Image" style="width: 60%;" /><p>The above sweeping visualization (thanks to Prof. Mark Horowitz and his group) shows the evolution of computer architectures is moving toward multicore designs. Today, multicore processors and multiprocessor systems are common in many electronic products such as mobiles, laptops, desktops, and servers. In order to keep up with the performance scaling, it is becoming necessary for software developers to write parallel programs that utilize the number of available cores.</p></section><section id="C0HeterogeneousComputing"><h2><a href="#C0HeterogeneousComputing">Heterogeneous Computing</a></h2><p>With the influence of artificial intelligence (AI) through new and merged workloads, heterogeneous computing becomes demanding and will continue to be heard for years to come. We have not just CPUs but GPUs, TPUs, FPGAs, and ASICs to accelerator a wide variety of scientific computing problems.</p><img class="m-image" src="CPU-vs-TPU-vs-GPU.png" alt="Image" style="width: 60%;" /><p>The question is: <em>How are we going to program these beasts?</em> Writing a high-performance sequential program is hard. Parallel programming is harder. Parallel programming of heterogeneous devices is extremely challenging if we care about performance and power efficiency. Programming models need to deal with productivity versus performance.</p></section><section id="LoopLevelParallelism"><h2><a href="#LoopLevelParallelism">Loop-level Parallelism</a></h2><p>The most basic and simplest concept of parallel programming is <em>loop-level parallelism</em>, exploiting parallelism that exists among the iterations of a loop. The program typically partitions a loop of iterations into a set of of blocks, either fixed or dynamic, and run each block in parallel. Below the figure illustrates this pattern.</p><img class="m-image" src="loop-level-parallelism.jpeg" alt="Image" style="width: 50%;" /><p>The main advantage of the loop-based approach is its simplicity in speeding up a regular workload in line with Amdahl&#x27;s Law. Programmers only need to discover independence of each iteration within a loop and, once possible, the parallel decomposition strategy can be easily implemented. Many existing libraries have built-in support to write a parallel-for loop.</p></section><section id="TaskBasedParallelism"><h2><a href="#TaskBasedParallelism">Task-based Parallelism</a></h2><p>The traditional loop-level parallelism is simple but hardly allows users to exploit parallelism in more irregular applications such as graph algorithms, incremental flows, recursion, and dynamically-allocated data structures. To address these challenges, parallel programming and libraries are evolving from the tradition loop-based parallelism to the <em>task-based</em> model.</p><div class="m-graph"><svg style="width: 18.900rem; height: 26.000rem;" viewBox="0.00 0.00 189.00 260.00">
<g transform="scale(1 1) rotate(0) translate(4 256)">
<title>Taskflow</title>
<g class="m-node m-flat">
<title>Task1</title>
<ellipse cx="99" cy="-234" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-230.12" font-family="Helvetica,sans-Serif" font-size="10.00">Task1</text>
</g>
<g class="m-node m-flat">
<title>Task2</title>
<ellipse cx="27" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-158.12" font-family="Helvetica,sans-Serif" font-size="10.00">Task2</text>
</g>
<g class="m-edge">
<title>Task1&#45;&gt;Task2</title>
<path d="M84.08,-218.5C74.23,-208.92 61.14,-196.19 49.97,-185.34"/>
<polygon points="52.59,-183 42.98,-178.54 47.71,-188.02 52.59,-183"/>
</g>
<g class="m-node m-flat">
<title>Task3</title>
<ellipse cx="99" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-158.12" font-family="Helvetica,sans-Serif" font-size="10.00">Task3</text>
</g>
<g class="m-edge">
<title>Task1&#45;&gt;Task3</title>
<path d="M99,-215.7C99,-208.41 99,-199.73 99,-191.54"/>
<polygon points="102.5,-191.62 99,-181.62 95.5,-191.62 102.5,-191.62"/>
</g>
<g class="m-node m-flat">
<title>Task4</title>
<ellipse cx="154" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="154" y="-86.12" font-family="Helvetica,sans-Serif" font-size="10.00">Task4</text>
</g>
<g class="m-edge">
<title>Task1&#45;&gt;Task4</title>
<path d="M111.75,-217.7C119.56,-207.59 129.15,-193.71 135,-180 143.26,-160.66 148.06,-137.38 150.77,-119.48"/>
<polygon points="154.21,-120.21 152.1,-109.83 147.27,-119.26 154.21,-120.21"/>
</g>
<g class="m-node m-flat">
<title>Task5</title>
<ellipse cx="82" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="82" y="-86.12" font-family="Helvetica,sans-Serif" font-size="10.00">Task5</text>
</g>
<g class="m-edge">
<title>Task2&#45;&gt;Task5</title>
<path d="M39.21,-145.46C46.11,-136.67 54.91,-125.48 62.73,-115.53"/>
<polygon points="65.47,-117.71 68.89,-107.68 59.96,-113.38 65.47,-117.71"/>
</g>
<g class="m-edge">
<title>Task3&#45;&gt;Task5</title>
<path d="M94.88,-144.05C93.07,-136.6 90.9,-127.64 88.85,-119.22"/>
<polygon points="92.31,-118.64 86.55,-109.75 85.51,-120.29 92.31,-118.64"/>
</g>
<g class="m-node m-flat">
<title>Task6</title>
<ellipse cx="118" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="118" y="-14.12" font-family="Helvetica,sans-Serif" font-size="10.00">Task6</text>
</g>
<g class="m-edge">
<title>Task4&#45;&gt;Task6</title>
<path d="M145.65,-72.76C141.42,-64.55 136.19,-54.37 131.42,-45.09"/>
<polygon points="134.68,-43.79 127,-36.49 128.46,-46.99 134.68,-43.79"/>
</g>
<g class="m-edge">
<title>Task5&#45;&gt;Task6</title>
<path d="M90.35,-72.76C94.58,-64.55 99.81,-54.37 104.58,-45.09"/>
<polygon points="107.54,-46.99 109,-36.49 101.32,-43.79 107.54,-46.99"/>
</g>
</g>
</svg>
</div><p>The above figure shows an example <em>task dependency graph</em>. Each node in the graph represents a task unit at function level and each edge indicates the task dependency between a pair of tasks. Task-based model offers a powerful means to express both regular and irregular parallelism in a top-down manner, and provides transparent scaling to large number of cores. In fact, it has been proven, both by the research community and the evolution of parallel programming standards, task-based approach scales the best with future processor generations and architectures.</p></section><section id="TheProjectMantra"><h2><a href="#TheProjectMantra">The Project Mantra</a></h2><p>The goal of Taskflow is simple - <em>We help developers quickly write parallel programs with high performance scalability and simultaneous high productivity</em>. We want developers to write simple and effective parallel code, specifically with the following objectives:</p><ul><li>Expressiveness</li><li>Readability</li><li>Transparency</li></ul><p>In a nutshell, code written with Taskflow explains itself. The transparency allows developers to focus on the development of application algorithms and parallel decomposition strategies, rather than low-level, system-specific details.</p></section>
      </div>
    </div>
  </div>
</article></main>
<div class="m-doc-search" id="search">
  <a href="#!" onclick="return hideSearch()"></a>
  <div class="m-container">
    <div class="m-row">
      <div class="m-col-m-8 m-push-m-2">
        <div class="m-doc-search-header m-text m-small">
          <div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
          <div id="search-symbolcount">&hellip;</div>
        </div>
        <div class="m-doc-search-content">
          <form>
            <input type="search" name="q" id="search-input" placeholder="Loading &hellip;" disabled="disabled" autofocus="autofocus" autocomplete="off" spellcheck="false" />
          </form>
          <noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.</noscript>
          <div id="search-help" class="m-text m-dim m-text-center">
            <p class="m-noindent">Search for symbols, directories, files, pages or
            modules. You can omit any prefix from the symbol or file path; adding a
            <code>:</code> or <code>/</code> suffix lists all members of given symbol or
            directory.</p>
            <p class="m-noindent">Use <span class="m-label m-dim">&darr;</span>
            / <span class="m-label m-dim">&uarr;</span> to navigate through the list,
            <span class="m-label m-dim">Enter</span> to go.
            <span class="m-label m-dim">Tab</span> autocompletes common prefix, you can
            copy a link to the result using <span class="m-label m-dim">⌘</span>
            <span class="m-label m-dim">L</span> while <span class="m-label m-dim">⌘</span>
            <span class="m-label m-dim">M</span> produces a Markdown link.</p>
          </div>
          <div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.</div>
          <ul id="search-results"></ul>
        </div>
      </div>
    </div>
  </div>
</div>
<script src="search-v2.js"></script>
<script src="searchdata-v2.js" async="async"></script>
<footer><nav>
  <div class="m-container">
    <div class="m-row">
      <div class="m-col-l-10 m-push-l-1">
        <p>Taskflow handbook is part of the <a href="https://taskflow.github.io">Taskflow project</a>, copyright © <a href="https://tsung-wei-huang.github.io/">Dr. Tsung-Wei Huang</a>, 2018&ndash;2024.<br />Generated by <a href="https://doxygen.org/">Doxygen</a> 1.9.6 and <a href="https://mcss.mosra.cz/">m.css</a>.</p>
      </div>
    </div>
  </div>
</nav></footer>
</body>
</html>
